<template>
  <el-dialog title="当前登录已过期" :visible.sync="dialogVisible" width="30%">
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-form-item label="账号" prop="name">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input v-model="form.password"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogFalse">取 消</el-button>
      <el-button type="primary" @click="login">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      dialogVisible: false,
      form: {
        name: "admin",
        password: "",
      },
      rules: {
        name: [{ required: true, message: "请输入账号", trigger: "blur" }],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
      },
    };
  },
  methods: {
    open() {
      this.dialogVisible = true;
    },
    login() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          console.log("登录");
          this.$store.state.lock = false;
          this.dialogVisible = false;

          this.$store.state.responseConfig.forEach((item) => {
            axios.request(item);
          });
          this.$store.state.responseConfig = [];
        } else {
        }
      });
    },
    dialogFalse() {},
  },
};
</script>

<style></style>
